-
Notifications
You must be signed in to change notification settings - Fork 827
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: make relay type fields extendable #1499
chore: make relay type fields extendable #1499
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #1499 +/- ##
==========================================
+ Coverage 95.97% 96.00% +0.02%
==========================================
Files 51 51
Lines 1739 1750 +11
==========================================
+ Hits 1669 1680 +11
Misses 70 70
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
311ae57
to
828e951
Compare
Thank you. This is cool. I don't feel qualified to approve or deny, but I do like the design. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So helpful going forward 👍 This will scrap a lot of workarounds from a lot of peoples codebases 🥳
This PR enables users to easily modify the
relay.Connection
type to add fields likenodes
, or customize the existingEdges
andPageInfo
fields to make changes about nullability.This is handy for cases like having a generic nodes field, that skips the use of edges for non-pagination use. The change is enabled by checking if
_meta
was already provided in the keyword arguments ofNode/Connection
'sinit_subclass_with_meta
, so we don't override existing field definitions from the superclass.The most common use case will be to add a generic
nodes
field for cases where cursor-based pagination is not necessary: